package v1;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.BufferedReader;
import java.io.FileReader;

import Kernel.Serveur;

public class Chargement {

	public static Serveur Charger(Serveur serveur) throws ClassNotFoundException, IOException{
		String filename = "fichier.data";
		FileInputStream fos = new FileInputStream(filename);
		ObjectInputStream out = new ObjectInputStream(fos);
		Serveur buff = new Serveur();
			buff = (Serveur) out.readObject();
			serveur = new Serveur(buff);
			out.close();
			return buff;
	}
	
	public static String exportSimple(Serveur serveur) throws ClassNotFoundException, IOException{
		BufferedReader bufferExport = new BufferedReader(new FileReader(
				"fichier.data"));
		String accu = "";
		while (bufferExport.ready()) {
			accu += bufferExport.readLine()+"\n";
		}
		return accu;
	}
}
